// TestTallies.cs
//

using jQueryApi;

namespace UnitTestHarness
{

    public sealed class TestTallies
    {
        int passed;
        int failed;
        int unknown;
        int total;
        int totalTime;

        public static string passedId = "testTalliesPassed";
        public static string failedId = "testTalliesFailed";
        public static string unknownId = "testTalliesUnknown";
        public static string totalId = "testTalliesTotal";
        public static string totalTimeId = "testTalliesTotalTime";

        public TestTallies()
        {
            Reset();
        }

        public void Reset()
        {
            total = passed = failed = unknown = 0;
            jQuery.Select("#" + passedId).Html("0");
            jQuery.Select("#" + failedId).Html("0");
            jQuery.Select("#" + unknownId).Html("0");
            jQuery.Select("#" + totalId).Html("0");
            jQuery.Select("#" + totalTimeId).Html("0");
        }

        public int Passed
        {
            get
            {
                return passed;
            }
            set
            {
                passed = value;
                jQuery.Select("#" + passedId).Html(passed.ToString());
            }
        }
        public int Failed
        {
            get
            {
                return failed;
            }
            set
            {
                failed = value;
                jQuery.Select("#" + failedId).Html(failed.ToString());
            }
        }
        public int Unknown
        {
            get
            {
                return unknown;
            }
            set
            {
                unknown = value;
                jQuery.Select("#" + unknownId).Html(unknown.ToString());
            }
        }
        public int Total
        {
            get
            {
                return total;
            }
            set
            {
                total = value;
                jQuery.Select("#" + totalId).Html(total.ToString());
            }
        }
        public int TotalTime
        {
            get
            {
                return totalTime;
            }
            set
            {
                totalTime = value;
                jQuery.Select("#" + totalTimeId).Html(totalTime.ToString() + "ms");
            }
        }
    }
}